package com.joker.userExam.controller.userManage;

import com.joker.userExam.model.UserInfo;
import com.joker.userExam.service.IUserManage;
import com.joker.userExam.utils.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author 李杰
 * @date 2021/5/7 - 22:02
 */
@CrossOrigin(origins = "http://localhost:3000")
@RestController
@RequestMapping("/userManage")
public class UserManage {
    @Autowired
    IUserManage userManage;

    @GetMapping("/queryUserInfo")
    public ResultUtil queryUserInfo() {
        return userManage.queryUserInfo();
    }

    @PostMapping("/queryUserInfoByCondition")
    public  ResultUtil queryUserInfoByCondition(@RequestBody UserInfo userInfo){
        return userManage.queryUserInfoByCondition(userInfo);
    }

    @PostMapping("/updateUserInfoById")
    public  ResultUtil updateUserInfoById(@RequestBody UserInfo userInfo){
        return userManage.updateUserInfoById(userInfo);
    }

    @GetMapping("/deleteUserInfoById")
    public ResultUtil deleteUserInfoById(@RequestParam Integer id) {
        return userManage.deleteUserInfoById(id);
    }

    @GetMapping("/queryAllCoach")
    public ResultUtil queryAllCoach(){
        return userManage.queryAllCoach();
    }

    @PostMapping("/saveUserInfo")
    public ResultUtil saveUserInfo(@RequestBody UserInfo userInfo){
        return userManage.saveUserInfo(userInfo);
    }

}
